//
//  YMGroupManager.h
//  YMIM
//
//  Created by reyzhang on 2022/3/21.
//

#import <Foundation/Foundation.h>
#import "YMGroupInfo.h"
#import "YMCommonDefs.h"
#import "YMConversation.h"

NS_ASSUME_NONNULL_BEGIN

/**
 * IM 群组管理器。 管理群组的创建
 */
@interface YMGroupManager : NSObject

/**
 * 创建群组
 *
 * @param name 群组名称
 *
 * @param portrait 群组图像
 *
 * @param uidsList 加入群组的用户列表
 *
 * @param label 分组标签，可以用来分组会话
 */
- (void)createGroupWithName:(NSString *)name
                   portrait:(NSString *)portrait
                       uids:(NSArray<NSString *> *)uidsList
                      label:(NSInteger)label
                 completion:(void(^)(YMGroupInfo *groupInfo, YMErrorCode code))completionBlock;

/**
 创建群组， 不分组会话
 */
- (void)createGroupWithName:(NSString *)name
                   portrait:(NSString *)portrait
                       uids:(NSArray<NSString *> *)uidsList
                 completion:(void(^)(YMGroupInfo *groupInfo, YMErrorCode code))completionBlock;



/**
 * 获取群组列表
 *
 * @param count 显示数据 0表示不限
 *
 * @param label 分组标签：区分一组群组列表
 */
- (void)getGroupListWithCount:(NSInteger)count
                        label:(NSInteger)label
              completionBlock:(void(^)(NSArray<YMConversation *> *dataSource, YMErrorCode code))completionBlock;

/**
 * 解散群组
 *
 * @param groupId 群组id
 */
- (void)dismissGroupWithGroupId:(NSString *)groupId
                     completion:(void(^)(YMErrorCode code))completionBlock;


/**
 * 邀请用户进群
 *
 * @param groupId 群组Id
 *
 * @param uidsList 用户唯一标识Id 数组
 */
- (void)inviteIntoGroupWithGroupId:(NSString *)groupId
                              uids:(NSArray<NSString *> *)uidsList
                        completion:(void(^)(YMErrorCode code))completionBlock;


/**
 * 请离群组
 *
 * @param groupId 群组Id
 *
 * @param uidsList 用户唯一身份数组
 */
- (void)kickGroupWithGroupId:(NSString *)groupId
                        uids:(NSArray<NSString *> *)uidsList
                  completion:(void(^)(YMErrorCode code))completionBlock;


/**
 * 用户离开群聊
 *
 * @param groupId 群组Id
 */
- (void)leaveGroupWithGroupId:(NSString *)groupId
                   completion:(void(^)(YMErrorCode code))completionBlock;



/**
 * 修改群组名称
 *
 * @param groupId 群组Id
 *
 * @param groupName 群组名称
 */
- (void)updateGroupNameWithGroupId:(NSString *)groupId
                         groupName:(NSString *)groupName
                        completion:(void(^)(YMErrorCode code))completionBlock;

@end

NS_ASSUME_NONNULL_END
